<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        td{
            border: 1px solid black;
            width: 70px;
            text-align: center;
        }
        table{
            border-collapse: collapse;
        }
        .tr1{
            background-color: aqua;
        }
    </style>
</head>
<body>
    <table>
        <tr>
            <th>序号</th>
            <th>名称</th>
            <th>价格</th>
            <th>数量</th>
            <th>操作</th>
        </tr>
        <tr class="d1">
            <td>11</td>
            <td>苹果</td>
            <td>56元</td>
            <td>17个</td>
            <td>甲级</td>
        </tr>
        <tr class="d1">
            <td>11</td>
            <td>苹果</td>
            <td>56元</td>
            <td>17个</td>
            <td>甲级</td>
        </tr>
        <tr class="d1">
            <td>11</td>
            <td>苹果</td>
            <td>56元</td>
            <td>17个</td>
            <td>甲级</td>
        </tr>
        <tr class="d1">
            <td>11</td>
            <td>苹果</td>
            <td>56元</td>
            <td>17个</td>
            <td>甲级</td>
        </tr>
        
    </table>
    <script>
        var nn = document.querySelector('table').querySelectorAll('.d1');
        for(var i = 0;i<nn.length;i++){
            nn[i].onmouseover = function(){
                
                this.className = 'tr1';
            }
            nn[i].onmouseout = function(){
                this.className = '';
            }
        }
    </script>
</body>
</html>